package com.zhouwen.ssm.controller;

import com.zhouwen.ssm.exception.MyException;
import com.zhouwen.ssm.service.ICommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/target")
public class TargetController {

    @Autowired
    private ICommodityService commodityService;

    @RequestMapping("/test2")
    @ResponseBody
    public void test2() throws Exception {
        /*Object str = "sdsss";
        Integer a = (Integer) str;*/
        throw new MyException();
//        int i = 1/0;
    }

    @RequestMapping("/test1")
    public ModelAndView test1(ModelAndView mv) {
        System.out.println("11111111111");
        mv.addObject("zw","zhouwen");
        mv.setViewName("findById");
        return mv;
    }

}
